package cn.rubintry.bug.hunting.viewpager

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.viewpager2.adapter.FragmentStateAdapter
import cn.rubintry.bug.hunting.fragment.TagArticleFragment
import cn.rubintry.bug.hunting.pojo.TagDataModel

class TagArticleVpAdapter(private val data: List<TagDataModel>,  fragmentManager: FragmentManager, lifecycle: Lifecycle) :
    FragmentStateAdapter(
        fragmentManager,
        lifecycle
    ) {

    override fun getItemCount(): Int {
        return data.size
    }

    override fun createFragment(position: Int): Fragment {
        return TagArticleFragment.newInstance(data[position].id)
    }
}